
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>skill · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="tcp-ip.html" />
    
    
    <link rel="prev" href="script.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    starting
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../INTRODUCTION.html">
            
                <a href="../INTRODUCTION.html">
            
                    
                    introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    algorithm
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../algorithm/graphic_processing/">
            
                <a href="../algorithm/graphic_processing/">
            
                    
                    graphic_processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../algorithm/machine_learning/">
            
                <a href="../algorithm/machine_learning/">
            
                    
                    machine_learning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../algorithm/other/">
            
                <a href="../algorithm/other/">
            
                    
                    other
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    language
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../language/cpp/">
            
                <a href="../language/cpp/">
            
                    
                    cpp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../language/golang/">
            
                <a href="../language/golang/">
            
                    
                    golang
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../language/java/">
            
                <a href="../language/java/">
            
                    
                    java
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../language/javascript/">
            
                <a href="../language/javascript/">
            
                    
                    javascript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../language/python/">
            
                <a href="../language/python/">
            
                    
                    python
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    soft_skills
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="docker.html">
            
                <a href="docker.html">
            
                    
                    docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="git.html">
            
                <a href="git.html">
            
                    
                    git
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="ideaj.html">
            
                <a href="ideaj.html">
            
                    
                    ideaj
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="linux.html">
            
                <a href="linux.html">
            
                    
                    linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="maven.html">
            
                <a href="maven.html">
            
                    
                    maven
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="mysql.html">
            
                <a href="mysql.html">
            
                    
                    mysql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="nginx.html">
            
                <a href="nginx.html">
            
                    
                    nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="node.js.html">
            
                <a href="node.js.html">
            
                    
                    node.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="oracle.html">
            
                <a href="oracle.html">
            
                    
                    oracle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="redis.html">
            
                <a href="redis.html">
            
                    
                    redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="script.html">
            
                <a href="script.html">
            
                    
                    script
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.12" data-path="skill.html">
            
                <a href="skill.html">
            
                    
                    skill
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.13" data-path="tcp-ip.html">
            
                <a href="tcp-ip.html">
            
                    
                    tcp-ip
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.14" data-path="ubuntu.html">
            
                <a href="ubuntu.html">
            
                    
                    ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.15" data-path="vscode.html">
            
                <a href="vscode.html">
            
                    
                    vscode
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.16" data-path="windows.html">
            
                <a href="windows.html">
            
                    
                    windows
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >skill</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x4F4D;&#x64CD;&#x4F5C;">&#x4F4D;&#x64CD;&#x4F5C;</h2>
<h3 id="&#x53D6;&#x6A21;&#xFF08;&#x53D6;&#x4F59;&#xFF09;">&#x53D6;&#x6A21;&#xFF08;&#x53D6;&#x4F59;&#xFF09;</h3>
<p>&#x53D6;&#x6A21;&#x8FD0;&#x7B97;&#x662F;&#x6D88;&#x8017;&#x6781;&#x5927;&#x7684;&#xFF0C;&#x5982;&#x4E0B;</p>
<blockquote>
<p><code>i % j == i - (i / j) * j</code></p>
</blockquote>
<p>&#x4F46;&#x662F;&#x5982;&#x679C; j &#x4E3A; 2 &#x7684; n &#x6B21;&#x65B9;&#xFF0C;&#x5219;</p>
<blockquote>
<p>&#x5F53; $j=2^n$ &#x65F6;&#xFF0C;<code>i % j == i &amp; (j - 1)</code></p>
</blockquote>
<p>Java &#x7684; <a href="https://zhuanlan.zhihu.com/p/21673805" target="_blank">HashMap</a> &#x7684;&#x6876;&#x6570;&#x91CF;&#x4E3A; 2 &#x7684; n &#x6B21;&#x65B9;&#xFF0C;&#x76EE;&#x7684;&#x5C31;&#x662F;&#x4E3A;&#x4E86;&#x4F7F;&#x7528;&#x4EE5;&#x4E0A;&#x7684;&#x53D6;&#x6A21;&#x65B9;&#x6CD5;</p>
<h3 id="&#x4E58;&#x9664;">&#x4E58;&#x9664;</h3>
<p>&#x5982;&#x679C;&#x4E58;&#x6570;&#x4E3A; 2 &#x7684; n &#x6B21;&#x65B9;&#xFF0C;&#x5219;</p>
<blockquote>
<p>&#x5F53; $j=2^n$ &#x65F6;&#xFF0C;<code>i * j == i &lt;&lt; n</code></p>
</blockquote>
<p>&#x5982;&#x679C;&#x9664;&#x6570;&#x4E3A; 2 &#x7684; n &#x6B21;&#x65B9;&#xFF0C;&#x4E14;&#x88AB;&#x9664;&#x6570;&#x4E3A;&#x6B63;&#x6570;&#xFF0C;&#x5219;</p>
<blockquote>
<p>&#x5F53; $j=2^n$ &#x65F6;&#xFF0C;<code>i / j == i &gt;&gt; n == i &gt;&gt;&gt; n</code></p>
</blockquote>
<p>&#x88AB;&#x9664;&#x6570;&#x4E0D;&#x80FD;&#x662F;&#x8D1F;&#x6570;</p>
<ul>
<li>&#x6570;&#x503C;&#x5728;&#x4E3B;&#x673A;&#x4E0A;&#x662F;&#x4EE5;&#x4E8C;&#x8FDB;&#x5236;&#x8865;&#x7801;&#x7684;&#x5F62;&#x5F0F;&#x5B58;&#x653E;&#x7684;</li>
<li>&#x6B63;&#x6570;&#x7684;&#x8865;&#x7801;&#x7B49;&#x4E8E;&#x5B83;&#x672C;&#x8EAB;&#xFF0C;&#x8D1F;&#x6570;&#x5219;&#x7B49;&#x4E8E;&#x5176;&#x6B63;&#x6570;&#x7684;&#x53CD;&#x7801;&#x52A0; 1</li>
</ul>
<p><code>&gt;&gt;</code> &#x548C; <code>&gt;&gt;&gt;</code> &#x7684;&#x5F02;&#x540C;</p>
<ul>
<li>&#x65B0;&#x589E;&#x7684;&#x4F4D;&#x4F7F;&#x7528; 0 &#x586B;&#x5145;</li>
<li>&#x524D;&#x8005;&#x53F3;&#x79FB;&#x9664;&#x4E86;&#x7B26;&#x53F7;&#x4F4D;&#x4EE5;&#x5916;&#x7684;&#x6240;&#x6709;&#x4F4D;&#xFF0C;&#x540E;&#x8005;&#x5C06;&#x7B26;&#x53F7;&#x4F4D;&#x4E00;&#x8D77;&#x53F3;&#x79FB;</li>
</ul>
<p>P.S. &#x5DE6;&#x79FB;&#x53EA;&#x6709; <code>&lt;&lt;</code>&#xFF0C;&#x6CA1;&#x6709; <code>&lt;&lt;&lt;</code></p>
<hr>

                                
                                </section>
                            
                        </div>
                    </div>
                
            </div>

            
                
                <a href="script.html" class="navigation navigation-prev " aria-label="Previous page: script">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="tcp-ip.html" class="navigation navigation-next " aria-label="Next page: tcp-ip">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"skill","level":"1.5.12","depth":2,"next":{"title":"tcp-ip","level":"1.5.13","depth":2,"path":"soft_skills/tcp-ip.md","ref":"soft_skills/tcp-ip.md","articles":[]},"previous":{"title":"script","level":"1.5.11","depth":2,"path":"soft_skills/script.md","ref":"soft_skills/script.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["-search","-sharing","-lunr"],"pluginsConfig":{"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"soft_skills/skill.md","mtime":"2020-03-17T14:44:39.349Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-17T16:45:36.070Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

